🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / network / src / commonMain / kotlin / org / meshtastic / core / network / service / ApiService.kt
Displaying Raw • Download
core/network/src/commonMain/kotlin/org/meshtastic/core/network/service/ApiService.kt 4e15ef1c7f68f8c683fe8b7ff741a5167e154d2e (4e15ef1c) Text, 2.10 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.network.service
Tff7b72import T7ee787io.ktor.client.HttpClient
Tff7b72import T7ee787io.ktor.client.call.body
Tff7b72import T7ee787io.ktor.client.request.get
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.model.NetworkDeviceHardware
Tff7b72import T7ee787org.meshtastic.core.model.NetworkFirmwareReleases
T8b949e/** Client for the Meshtastic public API (device hardware catalog and firmware releases). */
Tff7b72interface T56d364ApiService Tb4b4b4{
T8b949e/** Fetches the device hardware catalog from the Meshtastic API. */
Tff7b72suspend Tff7b72fun Td2a8ffgetDeviceHardwareTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3NetworkDeviceHardwareTff7b72>
T8b949e/** Fetches the list of available firmware releases from the Meshtastic API. */
Tff7b72suspend Tff7b72fun Td2a8ffgetFirmwareReleasesTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3NetworkFirmwareReleases
Tb4b4b4}
T8b949e/**
* Ktor-based [ApiService] implementation.
*
* Uses relative paths — the base URL is set via the `DefaultRequest` plugin in the platform Koin modules.
*
* Registered with `binds = []` to prevent Koin from auto-binding to [ApiService]; host modules (`app`, `desktop`)
* provide their own explicit `ApiService` binding to allow platform-specific `HttpClient` engines.
*/
Tf0883e@SingleTb4b4b4(Te6edf3binds Tff7b72= Tff7b72[Tff7b72]Tb4b4b4)
Tff7b72class T56d364ApiServiceImplTb4b4b4(Tff7b72private Tff7b72val Te6edf3clientTb4b4b4: Te6edf3HttpClientTb4b4b4) Tb4b4b4: Te6edf3ApiService Tb4b4b4{
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffgetDeviceHardwareTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3NetworkDeviceHardwareTff7b72> Tff7b72= Te6edf3clientTb4b4b4.Te6edf3getTb4b4b4(Ta5d6ff"Ta5d6ffresource/deviceHardwareTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3bodyTb4b4b4(Tb4b4b4)
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffgetFirmwareReleasesTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3NetworkFirmwareReleases Tff7b72= Te6edf3clientTb4b4b4.Te6edf3getTb4b4b4(Ta5d6ff"Ta5d6ffgithub/firmware/listTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3bodyTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s